#include "Thread.h"

using namespace FL;


void FL::Thread::Start()
{
	auto func = [&]()
	{
		mState = FL::Thread::State::TH_WORKING;
		Run();
		mState = FL::Thread::State::TH_END;
	};
	this->mThread = new std::thread(func);
}

void FL::Thread::Detach()
{
	mThread->detach();
}

void FL::Thread::Join()
{
	if (mThread->joinable())
	{
		mThread->join();
	}
}

bool FL::Thread::Joinable()
{
	return mThread->joinable();
}
